package ex1.basic;

import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;

public class JavaCollectionTwoDirectionIteratorDemo {
	public static void main(String[] args) {
		List<String> all = new ArrayList<String>();//为List父类接口进行实例化
		all.add("小李老师");//保存数据
		all.add("Java");
		all.add("www.scau.edu.cn");
		ListIterator<String> iter = all.listIterator();//获取ListIterator接口实例
		System.out.println("Output from forth to back:");
		while(iter.hasNext()) {
			System.out.println(iter.next()+", ");
		}
		System.out.println("Output from back to forth:");
		while(iter.hasPrevious()) {
			System.out.println(iter.previous()+", ");
		}
		
		
		
		
	}
}
